// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   SourceFile

package com.sgame.android.data;

import com.sgame.android.data.TunnelTransmittable;
import com.sgame.android.data.Tunnel;
import org.json.JSONException;
import org.json.JSONObject;

public class RewardCampaignCode
    implements TunnelTransmittable
{
    public static enum Field
    {
    	UID, CODE, CHANNEL, MARKETING_COPY, ICON_URL, REDEMPTIONS
    }


    public RewardCampaignCode()
    {
        a = null;
        b = null;
        c = null;
        d = null;
        e = null;
        f = 0;
    }

    public void setFromJson(JSONObject json)
    {
        a = json.optString(Field.UID.name());
        b = json.optString(Field.CODE.name());
        c = json.optString(Field.CHANNEL.name());
        d = json.optString(Field.MARKETING_COPY.name());
        if(d.length() == 0)
            d = json.optString("copy");
        e = json.optString(Field.ICON_URL.name());
        f = json.optInt(Field.REDEMPTIONS.name());
    }

    public JSONObject toJson()
    {
    	JSONObject obj = new JSONObject();
        try
        {
            obj.put(Field.UID.name(), a);
            obj.put(Field.CODE.name(), b);
            obj.put(Field.CHANNEL.name(), c);
            obj.put(Field.MARKETING_COPY.name(), d);
            obj.put(Field.ICON_URL.name(), e);
            obj.put(Field.REDEMPTIONS.name(), f);
        }
        // Misplaced declaration of an exception variable
        catch(JSONException ex)
        {
            throw new RuntimeException(((Throwable) (ex)));
        }
        return obj;
    }

    public String getUid()
    {
        return a;
    }

    public void setUid(String uid)
    {
        a = uid;
    }

    public String getCode()
    {
        return b;
    }

    public void setCode(String code)
    {
        b = code;
    }

    public String getMarketingCopy()
    {
        return d;
    }

    public void setMarketingCopy(String marketingCopy)
    {
        d = marketingCopy;
    }

    public String getChannel()
    {
        return c;
    }

    public void setChannel(String channel)
    {
        c = channel;
    }

    public String getIconUrl()
    {
        return e;
    }

    public void setIconUrl(String iconUrl)
    {
        e = iconUrl;
    }

    public int getRedemptions()
    {
        return f;
    }

    public void setRedemptions(int redemptions)
    {
        f = redemptions;
    }

    public String toJsonStringForTunnel()
    {
        return Tunnel.toString("RewardCampaignCode", toJson());
    }

    public void updateWithJsonObjectFromTunnel(JSONObject jsonObject)
    {
        setFromJson(jsonObject);
    }

    private String a;
    private String b;
    private String c;
    private String d;
    private String e;
    private int f;
}
